package com.nec.recommend.exception;

import com.nec.recommend.common.ResultCode;

//自定义业务异常
public class ServiceException extends RuntimeException {
    private final int code;
    private final String message;

    public ServiceException(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.message = resultCode.getMessage();
    }

    public ServiceException(String message) {
        this.code = 500;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
